﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.SessionState;
using WL_Store.BLL;
using WL_Store.Common;

namespace WL_Store.Web.ashx
{
    /// <summary>
    /// AdminInfo 的摘要说明
    /// </summary>
    public class AdminInfo : IHttpHandler, IRequiresSessionState
    {
        EmployeeInfoBLL bll = new EmployeeInfoBLL();
        OperateResult result = new OperateResult();
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

           

            string Action = context.Request.Form["Action"];
           
            if (Action == "Delete")
            {
                string  Id = context.Request.Form["DelId"];
                if (bll.DeleteEmployeeInfoProc(Id))
                {
                    result.State = 1;
                    result.Message = "删除成功！！！";
                }
                else
                {
                    result.State = -1;
                    result.Message = "删除失败！！！";
                }
            }

            //将对象转化为json格式的字符串（序列化）
            JavaScriptSerializer js = new JavaScriptSerializer();
            string json = js.Serialize(result);
            //返回json格式的字符串
            context.Response.Write(json);

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}